<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd">
    <namespaces>
        <Namespace>
            <prefix>gsml</prefix>
            <uri>urn:cgi:xmlns:CGI:GeoSciML:2.0</uri>
        </Namespace>
        <Namespace>
            <prefix>gml</prefix>
            <uri>http://www.opengis.net/gml</uri>
        </Namespace>
        <Namespace>
            <prefix>xlink</prefix>
            <uri>http://www.w3.org/1999/xlink</uri>
        </Namespace>
    </namespaces>
    <sourceDataStores>
        <DataStore>
            <id>GeologicUnit</id>
            <parameters>
                <Parameter>
                    <name>directory</name>
                    <value>file:./</value>
                </Parameter>
            </parameters>
        </DataStore>
    </sourceDataStores>
    <targetTypes>
        <FeatureType>
            <schemaUri>http://www.geosciml.org/geosciml/2.0/xsd/geosciml.xsd</schemaUri>
        </FeatureType>
    </targetTypes>
    <typeMappings>
        <FeatureTypeMapping>
            <!-- test mappingName won't break getFeature request for top level feature -->
            <sourceDataStore>GeologicUnit</sourceDataStore>
            <sourceType>Nillable</sourceType>
            <targetElement>gsml:GeologicUnit</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:GeologicUnit
					</targetAttribute>
                    <idExpression>
                        <OCQL>strConCat('gsml.geologicunit.',GEOLOGICUNIT_ID)</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gml:name
					</targetAttribute>
                    <sourceExpression>
                        <OCQL>NAME_VALUE</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>codeSpace</name>
                        <value>NAME_CODESPACE</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>gsml:bodyMorphology</targetAttribute>
                    <targetAttributeNode>gsml:CGI_TermValuePropertyType</targetAttributeNode>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                       gsml:bodyMorphology/gsml:CGI_TermValue/gsml:value
					</targetAttribute>
                    <sourceExpression>
                        <OCQL>BODY_VALUE</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>codeSpace</name>
                        <value>BODY_CODESPACE</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:composition/gsml:CompositionPart/gsml:lithology/gsml:ControlledConcept
                    </targetAttribute>
                    <idExpression>
                        <OCQL>strConCat('cc.1.',GEOLOGICUNIT_ID)</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                       gsml:composition/gsml:CompositionPart/gsml:lithology/gsml:ControlledConcept/gml:name
					</targetAttribute>
                    <sourceExpression>
                        <OCQL>'compositionName'</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                        gsml:composition/gsml:CompositionPart/gsml:lithology[2]/gsml:ControlledConcept
                    </targetAttribute>
                    <idExpression>
                        <OCQL>strConCat('cc.2.',GEOLOGICUNIT_ID)</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                       gsml:composition/gsml:CompositionPart/gsml:lithology[2]/gsml:ControlledConcept/gml:name
					</targetAttribute>
                    <sourceExpression>
                        <OCQL>BODY_VALUE</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                       gsml:preferredAge
					</targetAttribute>
                    <ClientProperty>
                        <name>xlink:href</name>
                        <value>'urn:ogc:def:nil:OGC:1.0:missing'</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>
                       gsml:rank
					</targetAttribute>
                    <sourceExpression>
                        <OCQL>BODY_VALUE</OCQL>
                    </sourceExpression>
					<encodeIfEmpty>true</encodeIfEmpty>	
                    <ClientProperty>
                        <name>codeSpace</name>
                        <value>BODY_CODESPACE</value>
                    </ClientProperty>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
    </typeMappings>
</as:AppSchemaDataAccess>
